package com.ybc.枚举和注解;


import java.util.EnumSet;

public class TextStyle {

    public static void main(String[] args) {
    }





    public enum Style { BOLD, ITALIC, UNDERLINE }



    //枚举集合 RegularEnumSet底层是位操作 很快
    public void applyStyle(EnumSet<Style> styles) {
        if (styles.contains(Style.BOLD)) System.out.println("Bold");
        if (styles.contains(Style.ITALIC)) System.out.println("Italic");
        if (styles.contains(Style.UNDERLINE)) System.out.println("Underline");
    }
}
